#pragma once
#include "LayerStack.hpp"
#include "../Tool/Singleton.h"
#include "Base.hpp"
#include "Window.hpp"
#include "../GameObject/Camera.h"

#include "../ImGuiLayer/ImGuiLayer.hpp"
#include "../Manager/Game/GameController.h"
int main(int argc, char** argv);

namespace Kriko
{
	class Application
	{
	public:
		Application(const std::string& p_name = "Kriko App");
		virtual ~Application();

		void OnEvent(IEventDataPtr pEvent);

		void PushLayer(Layer* p_Layer);
		void PushOverLayer(Layer* p_Layer);

		Window& GetWindow() { return *m_Window; }

		Camera* GetCameraPtr() { return pCamera; } 

		void Close();

		ImGuiLayer* GetImGuiLayer() { return m_ImGuiLayer; }

		static Application& Get() { return *s_Instance; }
	private:
		void Run();
		void OnWindowClose(IEventDataPtr p_Event);
		void OnWindowResize(IEventDataPtr p_Event);
	private:
		LayerStack m_LayerStack;
		std::unique_ptr<Window> m_Window; //Ψһ
		ImGuiLayer* m_ImGuiLayer;
		bool m_Running = true;
		bool m_Minimized = false;
		float m_LastFrameTime = 0.0f;
		Camera* pCamera;
	private:
		static Application* s_Instance;
		friend int ::main(int argc, char** argv);
	};
	Application* CreateApplication();
}